# core/parser.py
from typing import List
import sqlparse
from sqlparse.sql import Statement

def parse_sql(sql: str) -> List[Statement]:
    # 允许多条语句
    return [st for st in sqlparse.parse(sql) if str(st).strip()]

def statement_type(st: Statement) -> str:
    # sqlparse 自带类型判定，稳定
    return st.get_type().upper()
